﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _002银行ATM模拟
{
    class Program
    {
        static void Main(string[] args)
        {
            //当创建类的实例时自动调用无参构造函数
            BankAccount acc1 = new BankAccount("王小虎","ChinaBank0080011",50);
            acc1.PrintAccountInfo();
           
            Console.WriteLine("请输入您的存款金额:");
            int money = int.Parse(Console.ReadLine());
            //调用存款方法
            if (acc1.Deposit(money))
            {
                //存款成功
                Console.WriteLine("存款成功");
                acc1.PrintAccountInfo();
            }
            else
            {
                Console.WriteLine("输入的存款金额不合法，请重新输入!");
            }

            Console.WriteLine("请输入您的取款金额:");
            money = int.Parse(Console.ReadLine());
            //调用取款方法
            if (acc1.WithDraw(money))
            {
                Console.WriteLine("取款成功!");         
            }
            else
            {
                Console.WriteLine($"取款失败!{acc1.Message}");
            }
            acc1.PrintAccountInfo();

        }
    }
}
